package com.erp.erp_servers.business.imp;

import com.erp.erp_dao.business.ICarryDetailProductPartsDao;
import com.erp.erp_entitys.business.entity.CarryDetailProductPartsEntity;
import com.erp.erp_servers.business.ICarryDetailProductPartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName : CarryDetailProductPartsServiceImp
 * @Description : 出运明细产品配件实现层
 * @Author : lst
 * @Date: 2021-01-07 20:50
 */
@Service
public class CarryDetailProductPartsServiceImp implements ICarryDetailProductPartsService {

    /**
     * 注入出运明细产品配件mapper
     */
    private final ICarryDetailProductPartsDao carryDetailProductPartsDao;

    @Autowired
    public CarryDetailProductPartsServiceImp(ICarryDetailProductPartsDao carryDetailProductPartsDao) {
        this.carryDetailProductPartsDao = carryDetailProductPartsDao;
    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public CarryDetailProductPartsEntity queryById(Integer id) {
        return carryDetailProductPartsDao.queryById(id);
    }

    /**
     * 通过实体作为筛选条件查询
     *
     * @param carryDetailProductParts 实例对象
     * @return 对象列表
     */
    @Override
    public List<CarryDetailProductPartsEntity> queryAll(CarryDetailProductPartsEntity carryDetailProductParts) {
        return carryDetailProductPartsDao.queryAll(carryDetailProductParts);
    }

    /**
     * 新增数据
     *
     * @param carryDetailProductParts 实例对象
     * @return 影响行数
     */
    @Override
    public int insert(CarryDetailProductPartsEntity carryDetailProductParts) {
        return carryDetailProductPartsDao.insert(carryDetailProductParts);
    }

    /**
     * 修改数据
     *
     * @param carryDetailProductParts 实例对象
     * @return 影响行数
     */
    @Override
    public int update(CarryDetailProductPartsEntity carryDetailProductParts) {
        return carryDetailProductPartsDao.update(carryDetailProductParts);
    }


    /**
     * 批量新增
     * @param list 新增对象集合
     * @return 影响行数
     */
    @Override
    public int addList(List<CarryDetailProductPartsEntity> list) {
        return carryDetailProductPartsDao.addList(list);
    }

    /**
     * 通过父ID查询数据
     * @param id 产品id
     * @return 产品配件信息
     */
    @Override
    public List<CarryDetailProductPartsEntity> queryByParentId(Integer id) {
        return carryDetailProductPartsDao.queryByParentId(id);
    }
}
